package com.zhwmall.product.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhwmall.common.entity.product.AttrAttrgroupRelationEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 属性&属性分组关联
 *
 * @author zhw
 * @email sqzhou@88.com
 * @date 2020-08-18 16:52:35
 */
@Mapper
public interface AttrAttrgroupRelationDao extends BaseMapper<AttrAttrgroupRelationEntity> {

    @Insert({
            " <script> "+
            " insert into pms_attr_attrgroup_relation(attr_id, attr_group_id, attr_sort) values "+
            " <foreach collection='collect' item='item' index='index' separator=','> "+
            " (#{item.attrId}, #{item.attrGroupId}, #{item.attrSort}) "+
            " </foreach> "+
            " </script> "
    })
    void insertBatchByAttrGroupId(@Param("collect") List<AttrAttrgroupRelationEntity> collect);
}
